<template>
  <div>
    <h1>Home</h1>
    <router-link to="/home/music">
      <button>Music</button>
    </router-link>

    <router-link :to="{ name: 'News' }">
      <button>News</button>
    </router-link>

    <!-- 在v4版本中keep-alive的使用 缓存路由组件 -->
    <router-view v-slot="{ Component }">
      <keep-alive>
        <component :is="Component"></component>
      </keep-alive>
    </router-view>
  </div>
</template>

<script lang="ts">
  import { defineComponent } from "vue";
  export default defineComponent({
    name: "Home",
  });
</script>
<script lang="ts" setup></script>

<style lang="less" scoped></style>
